home *** CD-ROM | disk | FTP | other *** search
- /* copy3.c */
-
- #include <stdio.h>
- #include <stdlib.h>
-
- main(int argc, char *argv[])
- {
- if (argc == 3)
- {
- char s[BUFSIZ];
- FILE *inf, *outf;
-
- if ((inf = fopen(argv[1],"r")) == NULL)
- return EXIT_FAILURE;
-
- if ((outf = fopen(argv[2],"w")) == NULL)
- return EXIT_FAILURE;
-
- while (fgets(s,BUFSIZ,inf))
- fputs(s,outf);
-
- fclose(inf);
- fclose(outf);
- return EXIT_SUCCESS;
- }
- else
- return EXIT_FAILURE;
- }
-
-